package com.example.videoweb.service.impl;

import com.example.videoweb.dao.VideoMapper;
import com.example.videoweb.domain.Barrage;
import com.example.videoweb.domain.Video;
import com.example.videoweb.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class VideoServiceImpl implements VideoService {

    @Autowired
    public VideoMapper videoMapper;

    @Override
    public boolean insert(Video video) {
        return videoMapper.insert(video) > 0;
    }

    @Override
    public boolean update(Video video) {
        return videoMapper.update(video) > 0;
    }

    @Override
    public boolean delete(Integer id) {
        return videoMapper.delete(id) > 0;
    }

    @Override
    public Video selectByPrimaryKey(Integer id) {
        return videoMapper.selectByPrimaryKey(id);
    }

    @Override
    public boolean playById(Integer id) {
        return videoMapper.playById(id) > 0;
    }

    @Override
    public boolean praiseUp(Integer id) {
        return videoMapper.praiseUp(id) > 0;
    }
    @Override
    public boolean praiseDown(Integer id) {
        return videoMapper.praiseDown(id) > 0;
    }

    @Override
    public List<Video> allVideo() {
        return videoMapper.allVideo();
    }

    @Override
    public List<Video> getByVideoName(String videoName) {
        return videoMapper.getByVideoName("%"+videoName+"%");
    }

    @Override
    public List<Video> getByVideoStyle(Byte style) {
        return videoMapper.getByVideoStyle(style);
    }

    @Override
    public List<Video> getByVideoStyle2(Byte style) {
        return videoMapper.getByVideoStyle2(style);
    }

    @Override
    public List<Video> getByAuthorId(Integer authorId) {
        return videoMapper.getByAuthorId(authorId);
    }

    @Override
    public String getByBarrage(Integer id) {

        return videoMapper.getByBarrage(id);
    }


}
